import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import download from '../views/download.vue'
import split from '../views/split.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/download',
    children: [
      {
        path: 'download',
        name: 'download',
        component: download
      },
      {
        path: 'split',
        name: 'split',
        component: split
      }
    ]
  }
]
const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return routerPush.call(this, location).catch(error => error)
}

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
